<?php
require_once __dir__.'/common.php';
require_once __dir__.'/include/class.stat.php';

page::printTop();
?>

<style>
.stat {
	float:left;
	padding:30px;
	padding-bottom:20px;
	width:230px;
	font-size: 19.5px;
}

.stat * {
	font-size: 17.5px;
}

.stat_big {
	font-size: 30px;
}
</style>

<div class=stat>
<div class=stat_big>用户数：<?php echo stat::getCount('users'); ?></div>
<div class=stat_big>图片数：<?php echo stat::getCount('items'); ?></div>
<div class=stat_big>评价数：<?php echo stat::getCount('item_rates'); ?></div>
<div class=stat_big>回复数：<?php echo stat::getCount('item_replys'); ?></div>
<div class=stat_big>圈图数：<?php echo stat::getCount('item_circles'); ?></div>
</div>

<div class=stat>
用户发帖数 Top10
<?php
	$counter=0;
	foreach (stat::getTop("items", "user_id") as $line)
	{
		$user = user::getById($line['user_id']);
		echo sprintf("<div style='margin-left:30px'>[".(++$counter)."] <a target=_blank href=/user/%d/>%s</a> - %d</div>", $user['user_id'], $user['user_nickname'], $line['count']);
	}
?>
</div>

<div class=stat>
用户发表评论数 Top10
<?php
	$counter=0;
	foreach (stat::getTop("item_replys", "user_id") as $line)
	{
		$user = user::getById($line['user_id']);
		echo sprintf("<div style='margin-left:30px'>[".(++$counter)."] <a target=_blank href=/user/%d/>%s</a> - %d</div>", $user['user_id'], $user['user_nickname'], $line['count']);
	}
?>
</div>

<div class=stat>
用户发表圈图数 Top10
<?php
	$counter=0;
	foreach (stat::getTop("item_circles", "user_id") as $line)
	{
		$user = user::getById($line['user_id']);
		echo sprintf("<div style='margin-left:30px'>[".(++$counter)."] <a target=_blank href=/user/%d/>%s</a> - %d</div>", $user['user_id'], $user['user_nickname'], $line['count']);
	}
?>
</div>

<div class=stat>
用户发表评价数 Top10
<?php
	$counter=0;
	foreach (stat::getTop("item_rates", "user_id") as $line)
	{
		$user = user::getById($line['user_id']);
		echo sprintf("<div style='margin-left:30px'>[".(++$counter)."] <a target=_blank href=/user/%d/>%s</a> - %d</div>", $user['user_id'], $user['user_nickname'], $line['count']);
	}
?>
</div>

<div class=stat>
图片被评论数 Top10
<?php
	$counter=0;
	foreach (stat::getTop("item_replys", "item_id") as $line)
	{
		echo sprintf("<div style='margin-left:30px'>[".(++$counter)."] <a target=_blank href=/item/%d/>%s</a> - %d</div>", $line['item_id'], $line['item_id'], $line['count']);
	}
?>
</div>

<div class=stat>
图片被圈图数 Top10
<?php
	$counter=0;
	foreach (stat::getTop("item_circles", "item_id") as $line)
	{
		echo sprintf("<div style='margin-left:30px'>[".(++$counter)."] <a target=_blank href=/item/%d/>%s</a> - %d</div>", $line['item_id'], $line['item_id'], $line['count']);
	}
?>
</div>

<div class=stat>
图片被评价数 Top10
<?php
	$counter=0;
	foreach (stat::getTop("item_rates", "item_id") as $line)
	{
		echo sprintf("<div style='margin-left:30px'>[".(++$counter)."] <a target=_blank href=/item/%d/>%s</a> - %d</div>", $line['item_id'], $line['item_id'], $line['count']);
	}
?>
</div>

<!--div class="poster">&nbsp;</div-->

<script>
setInterval(function(){
	window.location.reload();
}, 60000);
</script>

<?php
page::printTail();
